package com.project.mapper;

import com.project.bean.ChannelBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface IChannelMapper {
    /**
     * 查询全部评到  同时统计全部主贴数量（外连接）
     * @return
     */
    @Select("SELECT c.*,COUNT(p.fk_channelId) num FROM t_channel c LEFT JOIN t_post p ON c.pk_channelId = p.fk_channelId GROUP BY p.fk_channelId")
    @ResultMap("clMap")
    public List<ChannelBean> findAll();

}
